// pages/mine/coupon.js
Page({
  data: {
    type:1,meallist:[]
  },

  
  onLoad: function (options) {
       wx.request({
         url: 'https://zujieba.com/Api/coupon/index',
         data:{uid:wx.getStorageSync('uid'),type:1},
         success:(res)=>{
              this.setData({
                meallist:res.data.data
              })
            
              console.log(res);
              
           
         }
       })
  },
  historyclick(){
   
    
     wx.navigateTo({
       url: '/pages/mine/coupon/history/history',
     })
  },
  //使用规则跳转
  ruleclick(){
    wx.navigateTo({
      url: '/pages/mine/coupon/rule/rule',
    })
  },
  //选择优惠券 弹窗
  showclick(e){
    console.log(e);
    const id=e.currentTarget.dataset.id
    
       wx.showModal({
         cancelColor: 'cancelColor',
         content:'是否选择这张优惠券',
         success:(res)=>{
        if(res.confirm==true){
          wx.getStorageSync('priceid',id)
            wx.showToast({
              title: '选用成功',

              
            })
        }
         }
       })
  }


})